<template>
  <div class="home">
    <router-link to="/todo">todo</router-link>
    <Com :name="'我是父组件传值'" @talk="talk" ref="comdemo"></Com>
  </div>
</template>

<script>
import { ref,onMounted } from 'vue'
import Com from "../components/Com.vue"

export default {
  
  name: "Home",
  components: {
    Com
  },
  setup(){
    const comdemo = ref(null);
      
    const talk = e =>{
      console.log(e)
    }
    onMounted(()=>{
      console.log(comdemo.value.str);
      comdemo.value.talk()
    })
    
    return{
      comdemo,
      talk
    }
  }
};
</script>
